//part1:C07:ex7.13.cpp
#include <iostream>
#include "Sales_data.h"

int main(void)
{
    using namespace std;
    Sales_data total(cin);
    if (cin)
    {
        Sales_data trans(cin);
        do
        {
            if (total.isbn() == trans.isbn())
            {
                total.combine(trans);
            }
            else
            {
                print_record(cout, total) << endl;
                total = trans;
            }
        }while(read_record(cin, trans));
        print_record(cout, total) << endl;
    }
    else
    {
        cerr << "No data?!" << endl;
    }

    return 0;
}



